# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=libkcddb
pkgver=20.04.3
pkgrel=0
arch="all !armhf" # armhf blocked by extra-cmake-modules
url="https://www.kde.org/applications/multimedia/"
pkgdesc="KDE CDDB library"
license="LGPL-2.0-or-later AND GPL-2.0-or-later"
makedepends="extra-cmake-modules qt5-qtbase-dev kconfig-dev kdoctools-dev kcodecs-dev ki18n-dev kio-dev kwidgetsaddons-dev libmusicbrainz-dev"
source="https://download.kde.org/stable/release-service/$pkgver/src/libkcddb-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
options="net" # Required for tests

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_TESTING=ON
	cmake --build build
}

check() {
	cd build
	# musicbrainztest-severaldiscs and asynccddblookuptest are broken
	# asynchttplookuptest fails to setup dbus
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E "(musicbrainztest-severaldiscs|asynchttplookuptest|asynccddblookuptest)"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="1b9fadb8a7d092999681d3f6bad4cb16960521d737d0fcace74b3b94a6f355984305d7fcdd3c9f53b3eefa65c861ddc3ce625ab56c4b1e505dfde693a3b1fe40  libkcddb-20.04.3.tar.xz"
